<?xml version="1.0" ?> 
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<!-- 
    These templates are for programmatic conveniences: printing blank
    lines, repeating and formatting text, etc.
-->

<xsl:template name="format-dollar-amount">
    <xsl:param name="amount"/>          
    <xsl:value-of select="format-number($amount,'$##,###,##0.00')"/>
</xsl:template>

<!-- Format 3-character all-caps month to month in initial caps -->
<xsl:template name="get-month-name">
    <xsl:param name="month"/>                       
        <xsl:choose>
            <xsl:when test="$month='JAN'">January</xsl:when>
            <xsl:when test="$month='FEB'">February</xsl:when>
            <xsl:when test="$month='MAR'">March</xsl:when>
            <xsl:when test="$month='APR'">April</xsl:when>
            <xsl:when test="$month='MAY'">May</xsl:when>
            <xsl:when test="$month='JUN'">June</xsl:when>
            <xsl:when test="$month='JUL'">July</xsl:when>
            <xsl:when test="$month='AUG'">August</xsl:when>
            <xsl:when test="$month='SEP'">September</xsl:when>
            <xsl:when test="$month='OCT'">October</xsl:when>
            <xsl:when test="$month='NOV'">November</xsl:when>
            <xsl:when test="$month='DEC'">December</xsl:when>
            <xsl:otherwise>INVALID MONTH</xsl:otherwise>
        </xsl:choose>       
</xsl:template>

<xsl:template name="create-date-filter-string">
    <xsl:param name="filterLabel"/>
    <xsl:param name="fromDate"/>
    <xsl:param name="toDate"/>
    <xsl:param name="noFilterDatesText"/>
    <xsl:choose>
        <xsl:when test="$fromDate !='' and $toDate !=''"> 
           <xsl:value-of select="$filterLabel"/> from 
           <xsl:value-of select="$fromDate"/> to 
           <xsl:value-of select="$toDate"/>                      
        </xsl:when>
        
        <xsl:when test="$toDate ='' and $fromDate !=''"> 
           <xsl:value-of select="$filterLabel"/> from 
           <xsl:value-of select="$fromDate"/>
        </xsl:when>
        
        <xsl:when test="$fromDate ='' and $toDate !=''"> 
           <xsl:value-of select="$filterLabel"/> to 
           <xsl:value-of select="$toDate"/>
        </xsl:when>
       
       <xsl:otherwise>
           <xsl:value-of select="$noFilterDatesText"/>
       </xsl:otherwise>
    </xsl:choose>      
</xsl:template>

<xsl:template name="create-blank-row">
    <fo:table-row>
        <fo:table-cell>
            <fo:block>&#160;</fo:block>
        </fo:table-cell>
    </fo:table-row>
</xsl:template>

<xsl:template name="create-trailing-row">
	<fo:table-row keep-with-previous="always">
	    <fo:table-cell>
	 		<fo:block>&#160;</fo:block>
	    </fo:table-cell>
	</fo:table-row>
</xsl:template>

<xsl:template name="proportional-column-width-repetition">
    <xsl:param name="count"/>
    <xsl:if test="number($count) > 0">
        <fo:table-column column-width="proportional-column-width(1)"/>
        <xsl:call-template name="proportional-column-width-repetition">
            <xsl:with-param name="count" select="number($count) - 1"/>
        </xsl:call-template>
    </xsl:if>
</xsl:template>  

<xsl:template name="fixed-column-width-repetition">
    <xsl:param name="count"/>
    <xsl:param name="size"/>
    <xsl:if test="number($count) > 0">
		<fo:table-column column-width="10pt * 0.60 * 'size'"/>
        <xsl:call-template name="fixed-column-width-repetition">
            <xsl:with-param name="count" select="number($count) - 1"/>
            <xsl:with-param name="size" select="$size"/>
        </xsl:call-template>
    </xsl:if>
</xsl:template>  

</xsl:stylesheet> 

